#include <iostream>
#include <queue>
using namespace std;

class MovingAverage{
    int capacity;
    int sum;
    queue<int> nums;
public:
    MovingAverage(int size){
        this->capacity = size;
        this->sum = 0;
    }
    double next(int val){
        if(nums.size() >= capacity){
            sum -= nums.front();
            nums.pop();
        }
        sum += val;
        nums.push(val);
        return sum * 1.0 / nums.size();
    }
};

int main(){
    MovingAverage window(3);
    for(int i = 1; i < 5; i++){
        cout<<window.next(i)<<endl;
    }
    return 0;
}